package String2;
/**
 * String支持正则表达式方法3
 * String.replaceAll(String regex,String replacement)
 * 将当前字符串满足的正则表达式替换成replacement
 * */
public class ReplaceAllDemo {
    public static void main(String[] args) {
        String str = "abc123def456ghi";
        str = str.replaceAll("[0-9]+","NUMBER");
        //str = str.replaceAll("[a-z]+","NUMBER");
        System.out.println(str);

        //
        String regex = "wqnmlgb|dsb|cnm|nc|nmsl|wrsndm|djb";
        String message = "wrsndm!你个dsb你也太nc了，你个djb!";
        message = message.replaceAll(regex,"***");
        System.out.println(message);
    }
}
